-- Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
--
-- this file licensed under the Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
--
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
-- PURPOSE.
-- See the Mulan PSL v2 for more details.
--
-- Author: auto generate
-- Create: 2025-10-19
-- Description: DO NOT EDIT; Code generated by "message.lua.mako"
local validate = require 'mc.validate'
local utils = require 'mc.utils'

local def_types = {}

---@class def_types.SyncObjectItem
---@field Interface string
---@field Properties string[]
local TSyncObjectItem = {}
TSyncObjectItem.__index = TSyncObjectItem
TSyncObjectItem.group = {}

local function TSyncObjectItem_from_obj(obj)
    return setmetatable(obj, TSyncObjectItem)
end

function TSyncObjectItem.new(Interface, Properties)
    return TSyncObjectItem_from_obj({Interface = Interface, Properties = Properties})
end
---@param obj def_types.SyncObjectItem
function TSyncObjectItem:init_from_obj(obj)
    self.Interface = obj.Interface
    self.Properties = obj.Properties
end

function TSyncObjectItem:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TSyncObjectItem.group)
end

TSyncObjectItem.from_obj = TSyncObjectItem_from_obj

TSyncObjectItem.proto_property = {'Interface', 'Properties'}

TSyncObjectItem.default = {'', {}}

TSyncObjectItem.struct = {
    {name = 'Interface', is_array = false, struct = nil}, {name = 'Properties', is_array = true, struct = nil}
}

function TSyncObjectItem:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'Interface', self.Interface, 'string', false, errs, need_convert)
    validate.OptionalArray(prefix .. 'Properties', self.Properties, 'string', false, errs, need_convert)

    TSyncObjectItem:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TSyncObjectItem.proto_property, errs, need_convert)
    return self
end

function TSyncObjectItem:unpack(_)
    return self.Interface, self.Properties
end

def_types.SyncObjectItem = TSyncObjectItem

return def_types
